From 84407935506cc21940addbd75e2e815dd465f012 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 9 Nov 2004 07:27:40 +0000 Subject: [PATCH] Apply a patch by Owen Taylor to get reasonable allocations for the 2004-11-09 Matthias Clasen * gtk/gtkstatusbar.c: Apply a patch by Owen Taylor to get reasonable allocations for the statusbar and its children. (#73359) --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ ChangeLog.pre-2-6 | 4 ++++ ChangeLog.pre-2-8 | 4 ++++ gtk/gtkstatusbar.c | 40 ++++++++-------------------------------- 5 files changed, 24 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6268ddb2f0..c6d6a8c0dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-11-09 Matthias Clasen + * gtk/gtkstatusbar.c: Apply a patch by Owen Taylor to + get reasonable allocations for the statusbar and its + children. (#73359) + * tests/testgtk.c: Apply a patch by Soeren Sandmann to test long statusbar texts. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6268ddb2f0..c6d6a8c0dc 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,9 @@ 2004-11-09 Matthias Clasen + * gtk/gtkstatusbar.c: Apply a patch by Owen Taylor to + get reasonable allocations for the statusbar and its + children. (#73359) + * tests/testgtk.c: Apply a patch by Soeren Sandmann to test long statusbar texts. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 6268ddb2f0..c6d6a8c0dc 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,9 @@ 2004-11-09 Matthias Clasen + * gtk/gtkstatusbar.c: Apply a patch by Owen Taylor to + get reasonable allocations for the statusbar and its + children. (#73359) + * tests/testgtk.c: Apply a patch by Soeren Sandmann to test long statusbar texts. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 6268ddb2f0..c6d6a8c0dc 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,9 @@ 2004-11-09 Matthias Clasen + * gtk/gtkstatusbar.c: Apply a patch by Owen Taylor to + get reasonable allocations for the statusbar and its + children. (#73359) + * tests/testgtk.c: Apply a patch by Soeren Sandmann to test long statusbar texts. diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index 4f3ffc3557..e14ccfeb53 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -526,10 +526,10 @@ get_grip_rect (GtkStatusbar *statusbar, w = 18; h = 18; - if (w > (widget->allocation.width)) + if (w > widget->allocation.width) w = widget->allocation.width; - if (h > (widget->allocation.height - widget->style->ythickness)) + if (h > widget->allocation.height - widget->style->ythickness) h = widget->allocation.height - widget->style->ythickness; rect->width = w; @@ -591,6 +591,7 @@ gtk_statusbar_create_window (GtkStatusbar *statusbar) statusbar->grip_window = gdk_window_new (widget->window, &attributes, attributes_mask); + gdk_window_set_user_data (statusbar->grip_window, widget); set_grip_cursor (statusbar); @@ -753,19 +754,6 @@ gtk_statusbar_size_request (GtkWidget *widget, gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), shadow_type); GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); - - if (statusbar->has_resize_grip) - { - GdkRectangle rect; - - /* x, y in the grip rect depend on size allocation, but - * w, h do not so this is OK - */ - get_grip_rect (statusbar, &rect); - - requisition->width += rect.width; - requisition->height = MAX (requisition->height, rect.height); - } } static void @@ -776,30 +764,18 @@ gtk_statusbar_size_allocate (GtkWidget *widget, statusbar = GTK_STATUSBAR (widget); - if (statusbar->has_resize_grip) + /* chain up normally */ + GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation); + + if (statusbar->has_resize_grip && statusbar->grip_window) { GdkRectangle rect; - GtkRequisition saved_req; - widget->allocation = *allocation; /* get_grip_rect needs this info */ get_grip_rect (statusbar, &rect); - if (statusbar->grip_window) gdk_window_move_resize (statusbar->grip_window, rect.x, rect.y, rect.width, rect.height); - - /* enter the bad hack zone */ - saved_req = widget->requisition; - widget->requisition.width -= rect.width; /* HBox::size_allocate needs this */ - if (widget->requisition.width < 0) - widget->requisition.width = 0; - GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation); - widget->requisition = saved_req; - } - else - { - /* chain up normally */ - GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation); } } + -- 2.30.2